/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.krArmor;

import java.io.IOException;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import ru.jSkyRoom.manager.JSkyGlobal;
import ru.jSkyRoom.manager.LocaleManager;
import ru.jSkyRoom.manager.ModImporter;
import ru.jSkyRoom.manager.ModManager;
import ru.jSkyRoom.generator.adapter.AutoSelectionItemsGenerator;
import ru.jSkyRoom.generator.command.Command;
import ru.jSkyRoom.interfaces.major.Armor;
import ru.jSkyRoom.support.GrupTypeBuilder;
import skyproc.GRUP_TYPE;
import skyproc.exceptions.MissingMaster;

/**
 *
 * @author Rakev
 */
public class KRArmor {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        KRArmor krArmor = new KRArmor();
        krArmor.initMod();
        EnchantmenterFactory enchantmenterFactory = new EnchantmenterFactory();
        AutoSelectionItemsGenerator<Armor> generator = enchantmenterFactory.create();
        Collection<Armor> enchantmentedArmors = generator.generate(enchantmenterFactory.getBaseArmorEdidRegex());
        Command<Collection<Armor>> levelListFiller = new LevelArmorListFillerFactory().create();
        levelListFiller.apply(enchantmentedArmors);
    }

    private void initMod() {
        try {
            GrupTypeBuilder typeBuilder = new GrupTypeBuilder().Armor().Enchantment().Keyword().LeveledItemList();
            String pathToData = "C:\\Steam\\SteamApps\\common\\skyrim\\Data\\";
            GRUP_TYPE[] grupTypes = typeBuilder.build();

            JSkyGlobal.getInstance().begin().selectLocale().selectRULocale().selectActiveMode(pathToData).beginCreatingMod("KepperV", "KRArmor").
                    importActiveMods(grupTypes);
        } catch (IOException ex) {
            Logger.getLogger(KRArmor.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MissingMaster ex) {
            Logger.getLogger(KRArmor.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
